var Signup = {
	init: function(){
		$("#username").focus();
		var themeclass = GetLS("theme")?GetLS("theme"):"contrast-green";
		$('body').addClass(themeclass);
		
		var value = GetLS("value");
		if (value) {
			$("#username").val(value);
			$("#password").val(GetLS("password")).focus();
		}	
		
		$("#login").click(function() {
			var value = $.trim($("#username").val());
			var pwd = $.trim($("#password").val());
			if(value == "" || pwd == ""){
				$alert("用户名或密码不能为空！");
			}else{
				$ajax({
					url: "/user/lgn",
					data: {
						value: value,
						pwd: pwd
					},
					success: function(res) {
						SetLS("user",res.result[0]);
						if(res.result[0].category == UTYPE.STUDENT)
							return alert("您没有登入权限");
						if($("#remember_me").prop('checked')) {
							SetLS("value", value);
							SetLS("password", pwd);
						} else
							SetLS("value", null);
						window.location.href = "index.html";
					}
				});
			}
		});
	}
}